package com.cos.consumer.feign;

import com.cos.common.entity.Student;
import com.cos.consumer.fallback.SupplierFeignClientFallBack;
import com.cos.consumer.fallback.SupplierFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: COS
 * @time: 2022/4/28 9:27
 * @description:
 */
@FeignClient(value = "SUPPLIER",
       // fallback = SupplierFeignClientFallBack.class
        fallbackFactory = SupplierFeignFallbackFactory.class
)
public interface SupplierFeignClient {
    /**
     *
     * @author: COS
     * @return:
     * @time: 2022/4/28 9:35
     * @description:
     * value 里面填写要请求的服务里面的web接口的路径 如:/emp/list
     */
    @RequestMapping(value = "/sup/getData",method = RequestMethod.GET)
    String getData();


    @GetMapping("/sup/getById/{id}")
    public Student getStudentById(@PathVariable("id") Integer id);
    //?
    @GetMapping("/sup/getStudent")
    public Student getStudent(@RequestParam(value = "sno") Integer id,
                              @RequestParam("name")String name,
                              @RequestParam String sex);
    @GetMapping("/sup/addStudent")
    public Student addStudent(@RequestBody Student student);

    @GetMapping("/sup/getStuList")
    public List<Student> getStuList() ;
}
